package com.firesrc.service.client;

import java.sql.ResultSet;
import java.util.List;

import com.firesrc.bean.Keyword;
import com.firesrc.service.KeywordService;
import com.firesrc.service.impl.KeywordServiceImpl;
import com.firesrc.util.GenerateSequenceUtil;
import com.firesrc.util.RstToListUitl;
import com.firesrc.util.SqlTsvTool;
import com.firesrc.util.SystemConfigConstant;

public class FetchKeywordTask extends SuperClientTask {

  protected boolean isEmptyRst(String handleData) {
    return false;
  }

  public void handleRespString(String result) {
    ResultSet rst = SqlTsvTool.getRstFromCsvString(result);
    List<Keyword> list = RstToListUitl.getKeywordListFromRst(rst);
    KeywordService service = new KeywordServiceImpl();
    for (Keyword keyword : list) {
      keyword.setId(GenerateSequenceUtil.generateSequenceNo());
      service.add(keyword);
    }
    System.out.println("FetchKeywordTask.handleRespString()result--->" + result);
  }

  @Override
  protected String getSendDataString() {
    return "";
  }

  @Override
  protected String getOpenatorType() {
    return SystemConfigConstant.FETCH_KEYWORD;
  }

}